package com.pignest.hotel.beans.global;

import java.io.File;
import java.io.Serializable;

import org.directwebremoting.annotations.DataTransferObject;
import org.directwebremoting.annotations.RemoteProperty;

import com.pignest.framework.util.Utils;

@DataTransferObject
public abstract class BaseBean implements Serializable {
	private static final long serialVersionUID = 1828572116147326413L;
	
	private static final char SEPARATOR = File.separatorChar;
	
	@RemoteProperty
	protected String id;
	
	public final String getId() {
		return id;
	}
	
	public final void setId(String id) {
		this.id = id;
	}

	/**
	 * 用于日志时的简单记录
	 * */
	public String toSimpleString() {
		return null;
	}
	
	public String toSimpleString(String perfix) {
		String s = toSimpleString();
		if (s == null)
			return perfix;
		return perfix + ":" + s;
	}
	
	protected static String concat(String... strings) {
		if (strings == null || strings.length == 0)
			return null;
		if (strings.length == 1)
			return strings[0];
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < strings.length; i++) {
			if (i > 0)
				sb.append(SEPARATOR);
			sb.append(strings[i]);
		}
		return sb.toString();
	}
	
	protected static String price(int money) {
		return Utils.toPrice(money);
	}
}
